Fires when the value for the configuration attribute `{{name}}` is changed. You can listen for the event using the `on` method if you wish to be notified before the attribute's value has changed, or using the `after` method if you wish to be notified after the attribute's value has changed.
13 | Parameters:
14 | `e` <EventFacade> An Event Facade object with the following attribute specific properties added:
15 |
16 |
`prevVal` The value of the attribute, prior to it being set
17 |
`newVal` The value the attribute is to be set to
18 |
`attrName` The name of the attribute being set
19 |
`subAttrName` If setting a property within the attribute's value, the name of the sub-attribute property being set
20 |
21 |
22 | {{/if}}
23 |
24 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright 2011 Yahoo! Inc.
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without
5 | modification, are permitted provided that the following conditions are met:
6 | * Redistributions of source code must retain the above copyright
7 | notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | * Neither the name of the Yahoo! Inc. nor the
12 | names of its contributors may be used to endorse or promote products
13 | derived from this software without specific prior written permission.
14 |
15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 | DISCLAIMED. IN NO EVENT SHALL YAHOO! INC. BE LIABLE FOR ANY
19 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 |
26 |
--------------------------------------------------------------------------------
/lib/index.js:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2011, Yahoo! Inc. All rights reserved.
3 | Code licensed under the BSD License:
4 | http://yuilibrary.com/license/
5 | */
6 | /**
7 | * Module creates the YUI instance with the required modules, uses them and exports the **Y** to be used
8 | * by the _CLI class_ or by extenders: `require('yuidocjs');`
9 | * You can use it like this:
10 |
11 | var options = {
12 | paths: [ './lib' ],
13 | outdir: './out'
14 | };
15 |
16 | var Y = require('yuidoc');
17 | var json = (new Y.YUIDoc(options)).run();
18 |
19 | * @class index
20 | * @exports {YUI} Y A YUI instance
21 | * @module yuidoc
22 | */
23 |
24 | var YUI = require('yui3').YUI,
25 | path = require('path');
26 |
27 | var Y = YUI({
28 | modules: {
29 | help: {
30 | fullpath: path.join(__dirname, 'help.js')
31 | },
32 | docparser: {
33 | fullpath: path.join(__dirname, 'docparser.js'),
34 | requires: ['base-base', 'json-stringify']
35 | },
36 | yuidoc: {
37 | fullpath: path.join(__dirname, 'yuidoc.js')
38 | },
39 | 'doc-builder': {
40 | fullpath: path.join(__dirname, 'builder.js')
41 | },
42 | utils: {
43 | fullpath: path.join(__dirname, 'utils.js')
44 | },
45 | docview: {
46 | fullpath: path.join(__dirname, 'docview.js')
47 | }
48 | },
49 | logExclude: {
50 | yui: true,
51 | get: true,
52 | loader: true,
53 | files: true
54 | }
55 | }).useSync('docparser', 'yuidoc', 'utils', 'doc-builder', 'docview', 'files', 'help');
56 |
57 | Y.packageInfo = Y.Files.getJSON(path.join(__dirname, '../', 'package.json'));
58 |
59 | module.exports = Y;
60 |
--------------------------------------------------------------------------------
/lib/docview.js:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2011, Yahoo! Inc. All rights reserved.
3 | Code licensed under the BSD License:
4 | http://yuilibrary.com/license/
5 | */
6 | YUI.add('docview', function(Y) {
7 |
8 |
9 | /*
10 | Selleck
11 | Copyright (c) 2011 Yahoo! Inc.
12 | Licensed under the BSD License.
13 | */
14 |
15 | /**
16 | View class borrowed from [Selleck](https://github.com/rgrove/selleck)
17 | The view class is a **`handlebars`** template helper.
18 | @class DocView
19 | @constructor
20 | @param {Object} data Meta data to use in this template
21 | @param {String} templateName The name of the template file to render.
22 | */
23 | function DocView(data, templateName) {
24 | this.templateName = templateName;
25 | Y.mix(this, data);
26 | }
27 |
28 | DocView.prototype = {
29 | /**
30 | * **Mustache** `lambda` method for setting the HTML title
31 | * @method htmlTitle
32 | */
33 | htmlTitle: function () {
34 | var name = this.displayName || this.name,
35 | title = name;
36 |
37 | if (title) {
38 | if (this.projectName) {
39 | title += ' - ' + this.projectName;
40 | }
41 | } else {
42 | title = this.projectName;
43 | }
44 |
45 | return title;
46 | },
47 |
48 | /**
49 | * **Mustache** `lambda` method for setting the title
50 | * @method title
51 | */
52 | title: function () {
53 | var name = this.displayName || this.name,
54 | title = this.projectName;
55 |
56 | if (name) {
57 | title += ': ' + name;
58 | }
59 |
60 | return title;
61 | }
62 | };
63 |
64 | Y.DocView = DocView;
65 | });
66 |
--------------------------------------------------------------------------------
/themes/default/layouts/main.handlebars:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {{htmlTitle}}
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
68 |
--------------------------------------------------------------------------------
/lib/help.js:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2011, Yahoo! Inc. All rights reserved.
3 | Code licensed under the BSD License:
4 | http://yuilibrary.com/license/
5 | */
6 | YUI.add('help', function(Y) {
7 |
8 | var help = [
9 | "",
10 | "YUI Doc generates API documentation from a modified JavaDoc syntax.",
11 | "",
12 | "Current version ({VERSION})",
13 | "",
14 | "Usage: yuidoc ",
15 | "",
16 | "Common Options:",
17 | " -c, --config, --configfile A JSON config file to provide configuration data.",
18 | " You can also create a yuidoc.json file and place it",
19 | " anywhere under your source tree and YUI Doc will find it",
20 | " and use it.",
21 | " -e, --extension The list of file extensions to parse ",
22 | " for api documentation. (defaults to .js)",
23 | " -x, --exclude Directorys to exclude from parsing ",
24 | " (defaults to '.DS_Store,.svn,CVS,.git,build_rollup_tmp,build_tmp')",
25 | " -v, --version Show the current YUIDoc version",
26 | " --project-version Set the doc version for the template",
27 | " -N, --no-color Turn off terminal colors (for automation)",
28 | " -n, --norecurse Do not recurse directories (default is to recurse)",
29 | " -S, --selleck Look for Selleck component data and attach to API meta data",
30 | " -V, --view Dump the Handlebars.js view data instead of writing template files",
31 | " -p, --parse-only Only parse the API docs and create the JSON data, do not render templates",
32 | " -o, --out Path to put the generated files (defaults to ./out)",
33 | " -t, --themedir Path to a custom theme directory containing Handlebars templates",
34 | " -h, --help Show this help",
35 | " -T, --theme Choose one of the built in themes (default is default)",
36 | "",
37 | " Supply a list of paths (shell globbing is handy here)",
38 | "",
39 | ].join('\n');
40 |
41 |
42 |
43 | Y.showHelp = function() {
44 | console.error(Y.Lang.sub(help, {
45 | VERSION: Y.packageInfo.version
46 | }));
47 | process.exit(1);
48 | }
49 | });
50 |
--------------------------------------------------------------------------------
/themes/simple/partials/method.handlebars:
--------------------------------------------------------------------------------
1 |
2 |
85 |
86 |
87 | Class defined in: lib/cli.js:3
88 |
Parses the arguments, creates the options and passes them to Y.YUIDoc.
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
--------------------------------------------------------------------------------
/tests/test/test.js:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * The test project
4 | * @project tester
5 | * @title The Tester
6 | * @icon http://a.img
7 | * @url http://one.url
8 | * @url http://two.url
9 | * @author admo
10 | * @contributor davglass
11 | * @contributor entropy
12 | */
13 |
14 | /**
15 | * The module
16 | * @module mymodule
17 | * @category one,two
18 | * @category three
19 | * @requires one
20 | * @requires two
21 | * @uses three
22 | * @uses four
23 | */
24 |
25 | /**
26 | * The submodule
27 | * @submodule mysubmodule
28 | * @category three,four
29 | */
30 |
31 |
32 | /**
33 | * The class def
34 | * @class myclass
35 | * @constructor
36 | */
37 |
38 | /**
39 | * test optional
40 | * @method testoptional
41 | * @param notype my desc
42 | * @param {int} namesecond my desc
43 | * @param namefirst {string} my desc
44 | * @param [optionalvar] {bool} my desc
45 | * @param {string} [optionalwithdefault="defaultval"] my desc
46 | * @evil
47 | * @injects {HTML} uses a string parameter to populate innerHTML
48 | * @returns something without a type
49 | * @example
50 | * This is code
51 | * @example
52 | * var = 'This is more code';
53 | * document.title = 'Test This';
54 | */
55 |
56 | /**
57 | * test object param
58 | * @method testobjectparam
59 | * @param {object} anobject the object
60 | * @param {string} anobject.prop1 prop1
61 | * @param {bool} anobject.prop2 prop2
62 | * @return {string} something with a type
63 | */
64 |
65 | /**
66 | * test 0..n param
67 | * @method test0ton
68 | * @param {string} [optionalandmultiple]* my desc
69 | * @returns something without a type
70 | */
71 |
72 | /**
73 | * test 1..n param
74 | * @method test1ton
75 | * @param {string} multiple* my desc
76 | * @returns something without a type
77 | */
78 |
79 | /**
80 | * Testing really long param description paring
81 | * @method reallyLongParamDesc
82 | * @param {Object} config Object with configuration property name/value pairs. The object can be
83 | * used to provide default values for the objects published attributes.
84 | *
85 | *
86 | * The config object can also contain the following non-attribute properties, providing a convenient
87 | * way to configure events listeners and plugins for the instance, as part of the constructor call:
88 | *
89 | *
90 | *
91 | *
on
92 | *
An event name to listener function map, to register event listeners for the "on" moment of the event. A constructor convenience property for the on method.
93 | *
after
94 | *
An event name to listener function map, to register event listeners for the "after" moment of the event. A constructor convenience property for the after method.
95 | *
bubbleTargets
96 | *
An object, or array of objects, to register as bubble targets for bubbled events fired by this instance. A constructor convenience property for the addTarget method.
97 | *
plugins
98 | *
A plugin, or array of plugins to be plugged into the instance (see PluginHost's plug method for signature details). A constructor convenience property for the plug method.
Module creates the YUI instance with the required modules, uses them and exports the Y to be used
89 | by the CLI class or by extenders: require('yuidocjs');
90 | You can use it like this:
91 |
92 |
var options = {
93 | paths: [ './lib' ],
94 | outdir: './out'
95 | };
96 |
97 | var Y = require('yuidoc');
98 | var json = (new Y.YUIDoc(options)).run();
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
--------------------------------------------------------------------------------
/lib/cli.js:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 | /*
3 | Copyright (c) 2011, Yahoo! Inc. All rights reserved.
4 | Code licensed under the BSD License:
5 | http://yuilibrary.com/license/
6 | */
7 |
8 | /**
9 | * Parses the arguments, creates the options and passes them to Y.YUIDoc.
10 | * @class cli
11 | * @module yuidoc
12 | */
13 |
14 | var Y = require('yuidocjs'),
15 | fs = require('fs'),
16 | path = require('path');
17 |
18 | var args = Y.Array(process.argv, 2),
19 | options = {};
20 |
21 | while (args.length > 0) {
22 | var v = args.shift();
23 | // options.* defined in ./builder.js
24 | switch (v) {
25 | case "-c":
26 | case "--config":
27 | case "--configfile":
28 | options.configfile = args.shift();
29 | break;
30 | case "-e":
31 | case "--extension":
32 | options.extension = args.shift();
33 | break;
34 | case "-x":
35 | case "--exclude":
36 | options.exclude = args.shift();
37 | break;
38 | case "-v":
39 | case "--version":
40 | console.error(Y.packageInfo.version);
41 | process.exit(1);
42 | break;
43 | case "--project-version":
44 | options.version = args.shift();
45 | break;
46 | case "-N":
47 | case "--no-color":
48 | Y.config.useColor = false;
49 | options.nocolor = true;
50 | break;
51 | case "-n":
52 | case "--norecurse":
53 | options.norecurse = true;
54 | break;
55 | case "-S":
56 | case "--selleck":
57 | options.selleck = true;
58 | break;
59 | case "-V":
60 | case "--view":
61 | options.dumpview = true;
62 | break;
63 | case "-p":
64 | case "--parse-only":
65 | options.parseOnly = true;
66 | break;
67 | case "-o":
68 | case "--outdir":
69 | options.outdir = args.shift();
70 | break;
71 | case "-t":
72 | case "--themedir":
73 | options.themedir = args.shift();
74 | break;
75 | case "-h":
76 | case "--help":
77 | Y.showHelp();
78 | break;
79 | case "-T":
80 | case "--theme":
81 | var theme = args.shift();
82 | options.themedir = path.join(__dirname, '../', 'themes', theme);
83 | break;
84 | default:
85 | if (!options.paths) {
86 | options.paths = [];
87 | }
88 | options.paths.push(v);
89 | }
90 | }
91 |
92 | Y.log('Starting YUIDoc@' + Y.packageInfo.version + ' using YUI@' + Y.version, 'info', 'yuidoc');
93 |
94 | var starttime = (new Date).getTime();
95 |
96 | var project = {};
97 | if (options.configfile) {
98 | project = Y.Files.getJSON(options.configfile);
99 | } else {
100 | Y.log('Scanning for yuidoc.json file.', 'info', 'yuidoc');
101 | project = Y.getProjectData();
102 | if (!project) {
103 | project = {};
104 | }
105 | }
106 |
107 |
108 | if (project.options && Object.keys(project.options).length) {
109 | options = Y.merge(project.options, options);
110 | delete project.options;
111 | options.project = project;
112 | }
113 |
114 | if (options.version && options.project) {
115 | options.project.version = options.version;
116 | delete options.version;
117 | }
118 |
119 | if (!options.outdir) {
120 | options.outdir = './out';
121 | }
122 |
123 | options.paths = Y.validatePaths(options.paths, options.ignorePaths);
124 |
125 | if (!options.paths.length) {
126 | Y.log('Paths argument was empty', 'warn', 'yuidoc');
127 | console.error(options);
128 | Y.showHelp();
129 | process.exit(1);
130 | }
131 |
132 | Y.log('Starting YUIDoc with the following options:', 'info', 'yuidoc');
133 | var opts = Y.clone(options);
134 | if (opts.paths && opts.paths.length && (opts.paths.length > 10)) {
135 | opts.paths = [].concat(opts.paths.slice(0, 5), [''], options.paths.slice(-5));
136 | }
137 | Y.log(opts, 'info', 'yuidoc');
138 |
139 | var json = (new Y.YUIDoc(options)).run();
140 | if (json.project) {
141 | options = Y.merge(options, json.project);
142 | }
143 | if (options.title && !options.name) {
144 | options.name = options.title;
145 | }
146 |
147 | if (!options.parseOnly) {
148 | var builder = new Y.DocBuilder(options, json);
149 | builder.compile(function() {
150 | var endtime = (new Date).getTime();
151 | Y.log('Completed in ' + ((endtime - starttime) / 1000) + ' seconds' , 'info', 'yuidoc');
152 | });
153 | }
154 |
--------------------------------------------------------------------------------
/api/modules/yuidoc.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | YUIDoc
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
64 | Fires when the value for the configuration attribute `{{name}}` is
65 | changed. You can listen for the event using the `on` method if you
66 | wish to be notified before the attribute's value has changed, or
67 | using the `after` method if you wish to be notified after the
68 | attribute's value has changed.
69 |
Perl formatting is really crappy. Partly because the author is lazy and
12 | partly because Perl is
13 | hard to parse.
14 |
On some browsers, <code> elements with newlines in the text
15 | which use CSS to specify white-space:pre will have the newlines
16 | improperly stripped if the element is not attached to the document at the time
17 | the stripping is done. Also, on IE 6, all newlines will be stripped from
18 | <code> elements because of the way IE6 produces
19 | innerHTML. Workaround: use <pre> for code with
20 | newlines.
21 |
22 |
23 |
Change Log
24 |
29 March 2007
25 |
26 |
Added tests for PHP support
27 | to address
28 | issue 3.
30 |
Fixed
31 | bug: prettyPrintOne was not halting. This was not
33 | reachable through the normal entry point.
34 |
Fixed
35 | bug: recursing into a script block or PHP tag that was not properly
37 | closed would not silently drop the content.
38 | (test)
39 |
Fixed bug: / in regex [charsets] should not end regex
62 |
63 |
5 Jul 2008
64 |
65 |
Defined language extensions for Lisp and Lua
66 |
67 |
14 Jul 2008
68 |
69 |
Language handlers for F#, OCAML, SQL
70 |
Support for nocode spans to allow embedding of line
71 | numbers and code annotations which should not be styled or otherwise
72 | affect the tokenization of prettified code.
73 | See the issue 22
74 | testcase.
75 |
76 |
6 Jan 2009
77 |
78 |
Language handlers for Visual Basic, Haskell, CSS, and WikiText
79 |
Added .mxml extension to the markup style handler for
80 | Flex MXML files. See
81 | issue 37.
84 |
Added .m extension to the C style handler so that Objective
85 | C source files properly highlight. See
86 | issue 58.
89 |
Changed HTML lexer to use the same embedded source mechanism as the
90 | wiki language handler, and changed to use the registered
91 | CSS handler for STYLE element content.
92 |
93 |
21 May 2009
94 |
95 |
Rewrote to improve performance on large files.
96 | See benchmarks.
97 |
Fixed bugs with highlighting of Haskell line comments, Lisp
98 | number literals, Lua strings, C preprocessor directives,
99 | newlines in Wiki code on Windows, and newlines in IE6.
100 |
101 |
14 August 2009
102 |
103 |
Fixed prettifying of <code> blocks with embedded newlines.
104 |
105 |
3 October 2009
106 |
107 |
Fixed prettifying of XML/HTML tags that contain uppercase letters.
108 |
Perl formatting is really crappy. Partly because the author is lazy and
12 | partly because Perl is
13 | hard to parse.
14 |
On some browsers, <code> elements with newlines in the text
15 | which use CSS to specify white-space:pre will have the newlines
16 | improperly stripped if the element is not attached to the document at the time
17 | the stripping is done. Also, on IE 6, all newlines will be stripped from
18 | <code> elements because of the way IE6 produces
19 | innerHTML. Workaround: use <pre> for code with
20 | newlines.
21 |
22 |
23 |
Change Log
24 |
29 March 2007
25 |
26 |
Added tests for PHP support
27 | to address
28 | issue 3.
30 |
Fixed
31 | bug: prettyPrintOne was not halting. This was not
33 | reachable through the normal entry point.
34 |
Fixed
35 | bug: recursing into a script block or PHP tag that was not properly
37 | closed would not silently drop the content.
38 | (test)
39 |
Fixed bug: / in regex [charsets] should not end regex
62 |
63 |
5 Jul 2008
64 |
65 |
Defined language extensions for Lisp and Lua
66 |
67 |
14 Jul 2008
68 |
69 |
Language handlers for F#, OCAML, SQL
70 |
Support for nocode spans to allow embedding of line
71 | numbers and code annotations which should not be styled or otherwise
72 | affect the tokenization of prettified code.
73 | See the issue 22
74 | testcase.
75 |
76 |
6 Jan 2009
77 |
78 |
Language handlers for Visual Basic, Haskell, CSS, and WikiText
79 |
Added .mxml extension to the markup style handler for
80 | Flex MXML files. See
81 | issue 37.
84 |
Added .m extension to the C style handler so that Objective
85 | C source files properly highlight. See
86 | issue 58.
89 |
Changed HTML lexer to use the same embedded source mechanism as the
90 | wiki language handler, and changed to use the registered
91 | CSS handler for STYLE element content.
92 |
93 |
21 May 2009
94 |
95 |
Rewrote to improve performance on large files.
96 | See benchmarks.
97 |
Fixed bugs with highlighting of Haskell line comments, Lisp
98 | number literals, Lua strings, C preprocessor directives,
99 | newlines in Wiki code on Windows, and newlines in IE6.
100 |
101 |
14 August 2009
102 |
103 |
Fixed prettifying of <code> blocks with embedded newlines.
104 |
105 |
3 October 2009
106 |
107 |
Fixed prettifying of XML/HTML tags that contain uppercase letters.
108 |
Perl formatting is really crappy. Partly because the author is lazy and
12 | partly because Perl is
13 | hard to parse.
14 |
On some browsers, <code> elements with newlines in the text
15 | which use CSS to specify white-space:pre will have the newlines
16 | improperly stripped if the element is not attached to the document at the time
17 | the stripping is done. Also, on IE 6, all newlines will be stripped from
18 | <code> elements because of the way IE6 produces
19 | innerHTML. Workaround: use <pre> for code with
20 | newlines.
21 |
22 |
23 |
Change Log
24 |
29 March 2007
25 |
26 |
Added tests for PHP support
27 | to address
28 | issue 3.
30 |
Fixed
31 | bug: prettyPrintOne was not halting. This was not
33 | reachable through the normal entry point.
34 |
Fixed
35 | bug: recursing into a script block or PHP tag that was not properly
37 | closed would not silently drop the content.
38 | (test)
39 |
Fixed bug: / in regex [charsets] should not end regex
62 |
63 |
5 Jul 2008
64 |
65 |
Defined language extensions for Lisp and Lua
66 |
67 |
14 Jul 2008
68 |
69 |
Language handlers for F#, OCAML, SQL
70 |
Support for nocode spans to allow embedding of line
71 | numbers and code annotations which should not be styled or otherwise
72 | affect the tokenization of prettified code.
73 | See the issue 22
74 | testcase.
75 |
76 |
6 Jan 2009
77 |
78 |
Language handlers for Visual Basic, Haskell, CSS, and WikiText
79 |
Added .mxml extension to the markup style handler for
80 | Flex MXML files. See
81 | issue 37.
84 |
Added .m extension to the C style handler so that Objective
85 | C source files properly highlight. See
86 | issue 58.
89 |
Changed HTML lexer to use the same embedded source mechanism as the
90 | wiki language handler, and changed to use the registered
91 | CSS handler for STYLE element content.
92 |
93 |
21 May 2009
94 |
95 |
Rewrote to improve performance on large files.
96 | See benchmarks.
97 |
Fixed bugs with highlighting of Haskell line comments, Lisp
98 | number literals, Lua strings, C preprocessor directives,
99 | newlines in Wiki code on Windows, and newlines in IE6.
100 |
101 |
14 August 2009
102 |
103 |
Fixed prettifying of <code> blocks with embedded newlines.
104 |
105 |
3 October 2009
106 |
107 |
Fixed prettifying of XML/HTML tags that contain uppercase letters.
108 |
' +
158 | 'No results found. Maybe you\'ll have better luck with a ' +
159 | 'different query?' +
160 | '
'
161 | );
162 | }
163 |
164 |
165 | focusManager.refresh();
166 | }
167 |
168 | function onTabSelectionChange(e) {
169 | var tab = e.newVal,
170 | name = tab.get('label').toLowerCase();
171 |
172 | tabs.selected = {
173 | index: tab.get('index'),
174 | name : name,
175 | tab : tab
176 | };
177 |
178 | switch (name) {
179 | case 'classes': // fallthru
180 | case 'modules':
181 | filter.setAttrs({
182 | minQueryLength: 0,
183 | queryType : name
184 | });
185 |
186 | search.set('minQueryLength', -1);
187 |
188 | // Only send a request if this isn't the initially-selected tab.
189 | if (e.prevVal) {
190 | filter.sendRequest(filter.get('value'));
191 | }
192 | break;
193 |
194 | case 'everything':
195 | filter.set('minQueryLength', -1);
196 | search.set('minQueryLength', 1);
197 |
198 | if (search.get('value')) {
199 | search.sendRequest(search.get('value'));
200 | } else {
201 | inputNode.focus();
202 | }
203 | break;
204 |
205 | default:
206 | // WTF? We shouldn't be here!
207 | filter.set('minQueryLength', -1);
208 | search.set('minQueryLength', -1);
209 | }
210 |
211 | if (focusManager) {
212 | setTimeout(function () {
213 | focusManager.refresh();
214 | }, 1);
215 | }
216 | }
217 |
218 | function onTabSwitchKey(e) {
219 | var currentTabIndex = tabs.selected.index;
220 |
221 | if (!(e.ctrlKey || e.metaKey)) {
222 | return;
223 | }
224 |
225 | e.preventDefault();
226 |
227 | switch (e.keyCode) {
228 | case 37: // left arrow
229 | if (currentTabIndex > 0) {
230 | tabview.selectChild(currentTabIndex - 1);
231 | inputNode.focus();
232 | }
233 | break;
234 |
235 | case 39: // right arrow
236 | if (currentTabIndex < (Y.Object.size(tabs) - 2)) {
237 | tabview.selectChild(currentTabIndex + 1);
238 | inputNode.focus();
239 | }
240 | break;
241 | }
242 | }
243 |
244 | }, '3.4.0', {requires: [
245 | 'api-filter', 'api-search', 'event-key', 'node-focusmanager', 'tabview'
246 | ]});
247 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [yui-customevents]: http://yuilibrary.com/yui/docs/event-custom/
2 | [yui-element]: http://developer.yahoo.com/yui/element/
3 |
4 | # YUIDoc Doc parser
5 |
6 | Updated yuidoc parser, written in js -- *early work in progress*
7 |
8 | ## Usage
9 |
10 | Clone this repo, then:
11 |
12 | cd yuidocjs
13 | npm -g install .
14 |
15 | yuidoc /path/to/yui3/src/
16 | yuidoc /path/to/yui2/src/
17 | yuidoc ./test/
18 |
19 | This will produce a data structure in `out/data.json` by default.
20 |
21 | ## Code implementation
22 |
23 | To log during a build:
24 | `Y.log("message", "console[method]", "module")`
25 |
26 | ## Command Line flags
27 | Usage: yuidoc
28 |
29 | Common Options:
30 | -c, --config, --configfile A JSON config file to provide configuration data.
31 | You can also create a yuidoc.json file and place it
32 | anywhere under your source tree and YUI Doc will find it
33 | and use it.
34 | -e, --extension The list of file extensions to parse
35 | for api documentation. (defaults to .js)
36 | -x, --exclude Directorys to exclude from parsing
37 | (defaults to '.DS_Store,.svn,CVS,.git,build_rollup_tmp,build_tmp')
38 | -v, --version Show the current YUIDoc version
39 | --project-version Set the doc version for the template
40 | -N, --no-color Turn off terminal colors (for automation)
41 | -n, --norecurse Do not recurse directories (default is to recurse)
42 | -S, --selleck Look for Selleck component data and attach to API meta data
43 | -V, --view Dump the Handlebars.js view data instead of writing template files
44 | -p, --parse-only Only parse the API docs and create the JSON data, do not render templates
45 | -o, --out Path to put the generated files (defaults to ./out)
46 | -t, --themedir Path to a custom theme directory containing Handlebars templates
47 | -h, --help Show this help
48 | -T, --theme Choose one of the built in themes (default is default)
49 | Supply a list of paths (shell globbing is handy here)
50 |
51 | ## Commenting Markup Guide
52 | YUIDoc original Python build - http://developer.yahoo.com/yui/yuidoc/
53 | (republished here for convenience, if that's ok)
54 |
55 | ### Primary tags - Each comment block must have one (and only one) of the following tags
56 | - **module**: There must be one module per source tree. By convention, put your module declaration at the top of the file that contains the main class for your module.
57 | - **class**: The string identifying the functional class on its parent object; for example, the class for YAHOO.util.Event would be Event (and its @namespace would be "YAHOO.util").
58 | - **method**: The name of a method on the current class.
59 | - **event**: In YUI, events are [Custom Events][yui-customevents] fired off programmatically at interesting moments in a component's execution. The event tag is similar to method, but there is no return tag and its params are arguments passed to the event listener.
60 | - **property**: The name of a property on the current class.
61 |
62 | ### Secondary tags - After choosing one of the four primary tags, you can further document a module, class, method, event or property with one or more of the following secondary tags.
63 | - **submodule**: YUI Doc supports the notion that a module is a submodule of a parent module. For example, in YUI 3.x anim-scroll is a submodule of anim. A submodule encompasses a subset of the parent module's functionality. To use submodule designation, provide the parent module's name as the module property and the submodule's name in the submodule property.
64 | - **namespace**: While it is optional to provide a namespace, it is recommended. This lets you describe your class just with the name: For example, YAHOO.util.Event has a namespace of YAHOO.util and a class of Event.
65 | - **extends**: Sets up an inheritance relationship between the current class and a parent class; API docs will show and link to items inherited from the parent class.
66 | - **config**: A config is a managed configuration attribute. In YUI parlance, this is typically an attribute created and managed with the Config class (part of the Container Family).
67 | - **attribute**: An attribute is a managed configuration attribute. In YUI parlance, this is typically an attribute created and managed with AttributeProvider (part of the [YUI Element Utility][[yui-element]]). An attribute is similar to a config, but YUI Doc will autogenerate documentation for the change events associated with the attribute as provided by Element. (Note: Unless you're using YUI and referring to an attribute managed by AttributeProvider, you should avoid using this tag.)
68 | - **constructor**: The presence of this tag (which requires no description) indicates that this class is instantiable.
69 | - **static**: If a class does not have a constructor, then the static tag should be present to signal that it is a static class.
70 | - **final**: For constants and for read-only configs and attributes.
71 | - **param**: Defined as @param {type} name description or @param name {type} description, params can be used with classes, methods and events. Use [name] to indicate the param is optional, name* to indicate it is a place holder for 1..n arguments, and [name*] for 0..n arguments.
72 | - **return**: Defined as @return {type} description.
73 | - **for**:
74 |
75 | Used to define an inner class:
76 |
77 | /**
78 | * An inner class
79 | * @class foo
80 | * @for OuterClass
81 | */
82 |
83 | After the class is done, you need to inform the parser to start working on the outer class again:
84 |
85 | /**
86 | * Another method for the outer class
87 | * @method bar
88 | * @for OuterClass
89 | */
90 |
91 | - **type**: For properties, configs and attributes.
92 | - **private**: Privates by default are suppressed from the API docs. All methods and properties are assumed to be public unless marked as private.
93 | - **protected**: Used to designate members that should not be modified by implementers unless they are creating a subclass.
94 | - **requires**: Used to identify dependencies in the module declaration.
95 | - **default**: The default value of a property, config or attribute.
96 | - **uses**: For classes that use YAHOO.lang.augmentProto or YAHOO.lang.augmentObject. Optional method/properties (supplied to augmentProto or augmentObject) are not parsed by YUI Doc.
97 |
98 | Example:
99 |
100 | /**
101 | * My method description. Like other pieces of your comment blocks,
102 | * this can span multiple lines.
103 | * @method methodName
104 | */
105 |
106 | ## Released under the YUI BSB License
107 |
108 | Copyright 2011 Yahoo! Inc.
109 | All rights reserved.
110 |
111 | Redistribution and use in source and binary forms, with or without
112 | modification, are permitted provided that the following conditions are met:
113 | * Redistributions of source code must retain the above copyright
114 | notice, this list of conditions and the following disclaimer.
115 | * Redistributions in binary form must reproduce the above copyright
116 | notice, this list of conditions and the following disclaimer in the
117 | documentation and/or other materials provided with the distribution.
118 | * Neither the name of the Yahoo! Inc. nor the
119 | names of its contributors may be used to endorse or promote products
120 | derived from this software without specific prior written permission.
121 |
122 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
123 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
124 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
125 | DISCLAIMED. IN NO EVENT SHALL YAHOO! INC. BE LIABLE FOR ANY
126 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
127 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
128 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
129 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
130 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
131 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
132 |
--------------------------------------------------------------------------------
/api/assets/vendor/prettify/README.html:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 | Javascript code prettifier
7 |
8 |
9 |
10 |
11 |
12 |
16 |
17 |
18 |
19 | Languages : CH
20 |
Include the script and stylesheets in your document
26 | (you will need to make sure the css and js file are on your server, and
27 | adjust the paths in the script and link tag)
28 |
Add onload="prettyPrint()" to your
32 | document's body tag.
33 |
Modify the stylesheet to get the coloring you prefer
34 |
35 |
36 |
Usage
37 |
Put code snippets in
38 | <pre class="prettyprint">...</pre>
39 | or <code class="prettyprint">...</code>
40 | and it will automatically be pretty printed.
41 |
42 |
43 |
44 |
The original
45 |
Prettier
46 |
47 |
class Voila {
49 | public:
50 | // Voila
51 | static const string VOILA = "Voila";
52 |
53 | // will not interfere with embedded tags.
54 | }
55 |
56 |
class Voila {
57 | public:
58 | // Voila
59 | static const string VOILA = "Voila";
60 |
61 | // will not interfere with embedded tags.
62 | }
63 |
64 |
65 |
FAQ
66 |
Which languages does it work for?
67 |
The comments in prettify.js are authoritative but the lexer
68 | should work on a number of languages including C and friends,
69 | Java, Python, Bash, SQL, HTML, XML, CSS, Javascript, and Makefiles.
70 | It works passably on Ruby, PHP, VB, and Awk and a decent subset of Perl
71 | and Ruby, but, because of commenting conventions, doesn't work on
72 | Smalltalk, or CAML-like languages.
73 |
74 |
LISPy languages are supported via an extension:
75 | lang-lisp.js.
If you'd like to add an extension for your favorite language, please
96 | look at src/lang-lisp.js and file an
97 | issue including your language extension, and a testcase.
99 |
100 |
How do I specify which language my code is in?
101 |
You don't need to specify the language since prettyprint()
102 | will guess. You can specify a language by specifying the language extension
103 | along with the prettyprint class like so:
104 |
<pre class="prettyprint lang-html">
106 | The lang-* class specifies the language file extensions.
107 | File extensions supported by default include
108 | "bsh", "c", "cc", "cpp", "cs", "csh", "cyc", "cv", "htm", "html",
109 | "java", "js", "m", "mxml", "perl", "pl", "pm", "py", "rb", "sh",
110 | "xhtml", "xml", "xsl".
111 | </pre>
112 |
113 |
It doesn't work on <obfuscated code sample>?
114 |
Yes. Prettifying obfuscated code is like putting lipstick on a pig
115 | — i.e. outside the scope of this tool.
116 |
117 |
Which browsers does it work with?
118 |
It's been tested with IE 6, Firefox 1.5 & 2, and Safari 2.0.4.
119 | Look at the test page to see if it
120 | works in your browser.
Why doesn't Prettyprinting of strings work on WordPress?
126 |
Apparently wordpress does "smart quoting" which changes close quotes.
127 | This causes end quotes to not match up with open quotes.
128 |
This breaks prettifying as well as copying and pasting of code samples.
129 | See
130 | WordPress's help center for info on how to stop smart quoting of code
132 | snippets.
133 |
134 |
How do I put line numbers in my code?
135 |
You can use the linenums class to turn on line
136 | numbering. If your code doesn't start at line number 1, you can
137 | add a colon and a line number to the end of that class as in
138 | linenums:52.
139 |
140 |
// This is line 4.
153 | foo();
154 | bar();
155 | baz();
156 | boo();
157 | far();
158 | faz();
159 |
160 |
161 |
How do I prevent a portion of markup from being marked as code?
162 |
You can use the nocode class to identify a span of markup
163 | that is not code.
164 |
<pre class=prettyprint>
165 | int x = foo(); /* This is a comment <span class="nocode">This is not code</span>
166 | Continuation of comment */
167 | int y = bar();
168 | </pre>
169 | produces
170 |
171 | int x = foo(); /* This is a comment This is not code
172 | Continuation of comment */
173 | int y = bar();
174 |
175 |
176 |
For a more complete example see the issue22
177 | testcase.
178 |
179 |
I get an error message "a is not a function" or "opt_whenDone is not a function"
180 |
If you are calling prettyPrint via an event handler, wrap it in a function.
181 | Instead of doing
182 |
Include the script and stylesheets in your document
26 | (you will need to make sure the css and js file are on your server, and
27 | adjust the paths in the script and link tag)
28 |
Add onload="prettyPrint()" to your
32 | document's body tag.
33 |
Modify the stylesheet to get the coloring you prefer
34 |
35 |
36 |
Usage
37 |
Put code snippets in
38 | <pre class="prettyprint">...</pre>
39 | or <code class="prettyprint">...</code>
40 | and it will automatically be pretty printed.
41 |
42 |
43 |
44 |
The original
45 |
Prettier
46 |
47 |
class Voila {
49 | public:
50 | // Voila
51 | static const string VOILA = "Voila";
52 |
53 | // will not interfere with embedded tags.
54 | }
55 |
56 |
class Voila {
57 | public:
58 | // Voila
59 | static const string VOILA = "Voila";
60 |
61 | // will not interfere with embedded tags.
62 | }
63 |
64 |
65 |
FAQ
66 |
Which languages does it work for?
67 |
The comments in prettify.js are authoritative but the lexer
68 | should work on a number of languages including C and friends,
69 | Java, Python, Bash, SQL, HTML, XML, CSS, Javascript, and Makefiles.
70 | It works passably on Ruby, PHP, VB, and Awk and a decent subset of Perl
71 | and Ruby, but, because of commenting conventions, doesn't work on
72 | Smalltalk, or CAML-like languages.
73 |
74 |
LISPy languages are supported via an extension:
75 | lang-lisp.js.
If you'd like to add an extension for your favorite language, please
96 | look at src/lang-lisp.js and file an
97 | issue including your language extension, and a testcase.
99 |
100 |
How do I specify which language my code is in?
101 |
You don't need to specify the language since prettyprint()
102 | will guess. You can specify a language by specifying the language extension
103 | along with the prettyprint class like so:
104 |
<pre class="prettyprint lang-html">
106 | The lang-* class specifies the language file extensions.
107 | File extensions supported by default include
108 | "bsh", "c", "cc", "cpp", "cs", "csh", "cyc", "cv", "htm", "html",
109 | "java", "js", "m", "mxml", "perl", "pl", "pm", "py", "rb", "sh",
110 | "xhtml", "xml", "xsl".
111 | </pre>
112 |
113 |
It doesn't work on <obfuscated code sample>?
114 |
Yes. Prettifying obfuscated code is like putting lipstick on a pig
115 | — i.e. outside the scope of this tool.
116 |
117 |
Which browsers does it work with?
118 |
It's been tested with IE 6, Firefox 1.5 & 2, and Safari 2.0.4.
119 | Look at the test page to see if it
120 | works in your browser.
Why doesn't Prettyprinting of strings work on WordPress?
126 |
Apparently wordpress does "smart quoting" which changes close quotes.
127 | This causes end quotes to not match up with open quotes.
128 |
This breaks prettifying as well as copying and pasting of code samples.
129 | See
130 | WordPress's help center for info on how to stop smart quoting of code
132 | snippets.
133 |
134 |
How do I put line numbers in my code?
135 |
You can use the linenums class to turn on line
136 | numbering. If your code doesn't start at line number 1, you can
137 | add a colon and a line number to the end of that class as in
138 | linenums:52.
139 |
140 |
// This is line 4.
153 | foo();
154 | bar();
155 | baz();
156 | boo();
157 | far();
158 | faz();
159 |
160 |
161 |
How do I prevent a portion of markup from being marked as code?
162 |
You can use the nocode class to identify a span of markup
163 | that is not code.
164 |
<pre class=prettyprint>
165 | int x = foo(); /* This is a comment <span class="nocode">This is not code</span>
166 | Continuation of comment */
167 | int y = bar();
168 | </pre>
169 | produces
170 |
171 | int x = foo(); /* This is a comment This is not code
172 | Continuation of comment */
173 | int y = bar();
174 |
175 |
176 |
For a more complete example see the issue22
177 | testcase.
178 |
179 |
I get an error message "a is not a function" or "opt_whenDone is not a function"
180 |
If you are calling prettyPrint via an event handler, wrap it in a function.
181 | Instead of doing
182 |
Include the script and stylesheets in your document
26 | (you will need to make sure the css and js file are on your server, and
27 | adjust the paths in the script and link tag)
28 |
Add onload="prettyPrint()" to your
32 | document's body tag.
33 |
Modify the stylesheet to get the coloring you prefer
34 |
35 |
36 |
Usage
37 |
Put code snippets in
38 | <pre class="prettyprint">...</pre>
39 | or <code class="prettyprint">...</code>
40 | and it will automatically be pretty printed.
41 |
42 |
43 |
44 |
The original
45 |
Prettier
46 |
47 |
class Voila {
49 | public:
50 | // Voila
51 | static const string VOILA = "Voila";
52 |
53 | // will not interfere with embedded tags.
54 | }
55 |
56 |
class Voila {
57 | public:
58 | // Voila
59 | static const string VOILA = "Voila";
60 |
61 | // will not interfere with embedded tags.
62 | }
63 |
64 |
65 |
FAQ
66 |
Which languages does it work for?
67 |
The comments in prettify.js are authoritative but the lexer
68 | should work on a number of languages including C and friends,
69 | Java, Python, Bash, SQL, HTML, XML, CSS, Javascript, and Makefiles.
70 | It works passably on Ruby, PHP, VB, and Awk and a decent subset of Perl
71 | and Ruby, but, because of commenting conventions, doesn't work on
72 | Smalltalk, or CAML-like languages.
73 |
74 |
LISPy languages are supported via an extension:
75 | lang-lisp.js.
If you'd like to add an extension for your favorite language, please
96 | look at src/lang-lisp.js and file an
97 | issue including your language extension, and a testcase.
99 |
100 |
How do I specify which language my code is in?
101 |
You don't need to specify the language since prettyprint()
102 | will guess. You can specify a language by specifying the language extension
103 | along with the prettyprint class like so:
104 |
<pre class="prettyprint lang-html">
106 | The lang-* class specifies the language file extensions.
107 | File extensions supported by default include
108 | "bsh", "c", "cc", "cpp", "cs", "csh", "cyc", "cv", "htm", "html",
109 | "java", "js", "m", "mxml", "perl", "pl", "pm", "py", "rb", "sh",
110 | "xhtml", "xml", "xsl".
111 | </pre>
112 |
113 |
It doesn't work on <obfuscated code sample>?
114 |
Yes. Prettifying obfuscated code is like putting lipstick on a pig
115 | — i.e. outside the scope of this tool.
116 |
117 |
Which browsers does it work with?
118 |
It's been tested with IE 6, Firefox 1.5 & 2, and Safari 2.0.4.
119 | Look at the test page to see if it
120 | works in your browser.
Why doesn't Prettyprinting of strings work on WordPress?
126 |
Apparently wordpress does "smart quoting" which changes close quotes.
127 | This causes end quotes to not match up with open quotes.
128 |
This breaks prettifying as well as copying and pasting of code samples.
129 | See
130 | WordPress's help center for info on how to stop smart quoting of code
132 | snippets.
133 |
134 |
How do I put line numbers in my code?
135 |
You can use the linenums class to turn on line
136 | numbering. If your code doesn't start at line number 1, you can
137 | add a colon and a line number to the end of that class as in
138 | linenums:52.
139 |
140 |
// This is line 4.
153 | foo();
154 | bar();
155 | baz();
156 | boo();
157 | far();
158 | faz();
159 |
160 |
161 |
How do I prevent a portion of markup from being marked as code?
162 |
You can use the nocode class to identify a span of markup
163 | that is not code.
164 |
<pre class=prettyprint>
165 | int x = foo(); /* This is a comment <span class="nocode">This is not code</span>
166 | Continuation of comment */
167 | int y = bar();
168 | </pre>
169 | produces
170 |
171 | int x = foo(); /* This is a comment This is not code
172 | Continuation of comment */
173 | int y = bar();
174 |
175 |
176 |
For a more complete example see the issue22
177 | testcase.
178 |
179 |
I get an error message "a is not a function" or "opt_whenDone is not a function"
180 |
If you are calling prettyPrint via an event handler, wrap it in a function.
181 | Instead of doing
182 |